;+
; NAME: probeval
;
; PURPOSE:  Evaluate the probability distribution to determine if a
; distance is well known.
;
; CALLING SEQUENCE:
;   PROBEVAL, d, p, [distance = distance,dist_err = dist_err]
;
; INPUTS:
;
;
;
; KEYWORD PARAMETERS:
;
;
;
; OUTPUTS:
;
;
;
; MODIFICATION HISTORY:
;
;-
PRO PROBEVAL, dist, pvec, distance = median_dist, ml_dist = ml_dist, $
              pos_err = pos_err, neg_err = neg_err
  
  COMPILE_OPT OBSOLETE
  
  maxprob = max(pvec,peak)
  ml_dist = dist[peak]
  
  cdf = total(pvec,/cum)
  
  median_dist = interpol(dist,cdf,0.5)
  pos_err = interpol(dist,cdf,0.84134475)
  neg_err = interpol(dist,cdf,0.15865525)
  
  
  RETURN
END
